var _contract = null;
function setPrintData(contract) {
  _contract = contract;
  _prt.setPageSize(210, 297);
  _prt.setMargin(15,15,15,15);
  _prt.setLineHeight(5);
  _prt.setPageFoot(" {pg}/3                                        电子合同校验码："+contract.printVerifyCode);

  _prt.add(["sf", "12pt 黑体"]);
  _prt.add(["dt", "Personal Training Agreement 私人/小组训练合同", 95, 15 + 7]);
  _prt.add(["sp", 0, 0]);
  _prt.add(["pi", "/images/logo.png", 50, 10]);
  _prt.add(["pl"]);

  _prt.add(["sf", "9pt 宋体"]);
  _prt.add(["nt", "Home Club 专属会所："+contract.shopName, 0.5]);
  _prt.add(["nt", "Membership NO. 会员编号："+contract.memberCode, 0.5]);
  //_prt.add(["nt", "Membership Consultant 会籍顾问："+contract.salesName+" "+contract.salesName2, 0.5]);
  _prt.add(["nt", "Contract No. 合同编号："+contract.contractCode, 0.5]);
  _prt.add(["nl", 1]);
  _prt.add(["pl"]);
  _prt.add(["nt", "Name 姓名："+contract.memberName, 0.5]);
  _prt.add(["nt", "Personal Trainer 教练："+contract.coachName, 0.5]);
  _prt.add(["nt", "Category 课程类型："+contract.ptCodeName, 0.5]);
  _prt.add(["nt", "No.of Sessions 课程数量："+contract.quantity, 0.5]);
  _prt.add(["nt", "Total Fee 课程类型费用："+contract.factPrice+"元", 0.5]);
  _prt.add(["nt", "Received 已收金额："+contract.payAmount+"元", 0.5]);
  _prt.add(["nl", 1.5]);
  _prt.add(["pt", "I understand and agree to the starting date. Please provide your signature."]);
  _prt.add(["pt", "我明白及同意以此日期生效签署"]);
  _prt.add(["pl"]);

  _prt.add(["pt", ""]);
  _prt.add(["sf", "12pt 黑体"]);
  _prt.add(["pt", "会员章程 Club Rules"]);
  _prt.add(["nl", 0.2]);
  _prt.add(["sf", "9pt 宋体"]);
  _prt.add(["pt", ""]);

  var dd = parseInt((parseDate(contract.endTime).getTime() - parseDate(contract.beginTime).getTime())/1000/60/60/24);

  _prt.add(["pt", "1.会员须全额付清依本协议应付之金额总数后，方得开始本训练课程。"]);
  _prt.add(["pt", "Club members must take the full payment listed on the contract before starting the corresponding training courses."]);
  _prt.add(["pt", ""]);
  _prt.add(["pt", "2.所有训练堂数必须于协议有效期内执行完毕，本协议内容为 "+contract.quantity+" 堂，共计有效期为 "+dd+" 日，在签订本合同当日起算。 (第一次购买私教课程起算日为合同签订之日的下一日，续买私教课程的起算日为上一个合同结束日的下一日)， 于上述有效期限内未使用完毕之堂教，将自动视为会员放弃使用之权利，会员不得要求退还该金额或转让他人使用，亦不得要求延长有效期限，但因为特殊状况经本公司书面同意者，不在此限。 "]);
  _prt.add(["pt", "All the courses must be completed before the expiration date. According to this contract, the number of all courses is "+contract.quantity+", and the period of validity should be "+dd+" days (for new contract, the start date is the next day of contract award date. For renewed contract, the starting date is the next day of the expiry date of previous contract.), any courses not finished within the valid period listed above would be considered as club members giving up the training spontaneously."]);
  _prt.add(["pt", ""]);
  _prt.add(["pt", "3.会员必须于每次训练课程时于表格签名栏内亲自签名。"]);
  _prt.add(["pt", "Members must sign their names on the name list before every course starts."]);
  _prt.add(["pt", ""]);
  _prt.add(["pt", "4.会员系与威康健身管理咨询（上海）有限公司签订私人小组训练合同，若原订教练无法提供指导的，威康公司可以安排其他合格教练代替。"]);
  _prt.add(["pt", "Will's Group can provide other qualified personal trainer if the original personal trainer cannot provide satisfactory instruction once club members have signed a Personal Training Agreement."]);
  _prt.add(["pt", ""]);
  _prt.add(["pt", "5.所有已缴纳之款项不得用于垫付任何其他费用。"]);
  _prt.add(["pt", "There's no refund or transfer for all the already -made payment."]);
  _prt.add(["pt", ""]);
  _prt.add(["pt", "6.会员所购买的训练堂数，在合同有效期内，会员在向本会所缴纳转让课程总金额的15%的转让费后，可将上述课程转让给本会所其他会员。"]);
  _prt.add(["pt", "Within the validity of the agreement, the number can transfer courses he bought to other members of our clubs after paying 15% of the amount of courses for transfer fee."]);
  _prt.add(["pt", ""]);
  _prt.add(["pt", "7.私教训练合同开始期间，如会员单方面提出解除训练课程，视为违约，须按照课程总额的30%支付违约金。"]);
  _prt.add(["pt", "If the members terminate the contract unilaterally, it will be considered a default and the members should pay 30% of the amount of courses as penalty from the date of signing the PT contract."]);
  _prt.add(["pt", ""]);
  _prt.add(["pt", "8.如欲取消所有预约上课时间，需提前24小时以上电话通知缓冲作业，否则仍需支付该堂费用。"]);
  _prt.add(["pt", "If there’s the need to cancel the course, please notify us 24 hours in advance, otherwise you still have to pay for the courses."]);
  _prt.add(["pt", ""]);
  _prt.add(["pt", "会员健康告知 Physical Condition and Medical Advice "]);
  _prt.add(["pt", ""]);
  _prt.add(["pt", "1.会员表明身体状况良好，无身体缺陷，伤残或疾病，以及无法使用威康健身管理咨询 (上海) 有限公司之全部设施及私人教练服务之情况。会员确认在签署本协议书前及后，给予任何医护方面之意见。倘若会员有任何健康或医护方面问题，应立即自行向医生查询后，方得使用本会馆设施及接受私人教练课程。"]);
  _prt.add(["pt", "Member represents that he is in good condition and has no medical reason, impairment or disability that preventing him from using all the facilities and Personal Training services of Will’s Fitness Management(Shanghai) Ltd. , for example, you acknowledge that Will’s Fitness Management(Shanghai) Limited did not give him medical advice before he signs this agreement, and cannot give him any after you signs this agreement, relating to his physical condition and ability use the facilities and group exercise services if he has any health or medical concerns, now or after he signs, discuss them with his doctor before using the facilities and personal training."]);
  _prt.add(["pt", ""]);
  _prt.add(["pt", "2.使用限制 Usage Limitation"]);
  _prt.add(["pt", "会员知悉或应知悉：须在私人教练的带领下方可在会所私教专用区域运动或使用该区域的器械。"]);
  _prt.add(["pt", "Member note: Club members can exercise in the private area or use instrument of the private area of the club."]);
  _prt.add(["pt", ""]);
  _prt.add(["pt", "3.本会所员工可以根据会员的身体特点、训练特点等向会员介绍本会所自营或代理之营养食品。 "]);
  _prt.add(["pt", "Club staffs have right to introduce self-supporting or agent nutritional foods to club members according to their own physical characteristics, training characteristics etc."]);
  _prt.add(["pt", ""]);
  _prt.add(["pt", "4.风险保证  Risk Guarantee	"]);
  _prt.add(["pt", "在威康健身管理咨询（上海）有限公司使用任何设施，均有可能由于自己或他人的缘故，导致会员本身或其他第三人受伤，如因为使用设施者之疏失所造成的任何精神损害，身体伤害或财物损失的，各方自愿协商，协商不成的，同意将争议交由事故发生地法院以诉讼方式解决。"]);
  _prt.add(["pt", "There is a possibility that when using the facilities in Will’s Fitness Management (Shanghai) Limited, our club members be hurt due to his or others' negligence. Our club member understands and accepts that whatever kind of hurt that happens to club member himself, his spouse, his visitors, pregnant woman, infant or his relatives would not be considered as our company's responsibility, this also includes the mental injury, physical injury or property loss due to the misuse of the facilities by club members. Also, club member understands that Will’s Fitness Management (Shanghai) Limited provides fitness services instead of buying or reselling facilities, so Will’s Fitness Management (Shanghai) Limited is not responsible for any hurt caused by any unqualified facilities."]);
  _prt.add(["pt", ""]);
  _prt.add(["pt", "5.此合约只适用于威尔士集团之会员和威尔士集团健身会所。 "]);
  _prt.add(["pt", "This agreement is valid for current member of Will’s Club, applicable within Will’s Club, only."]);
  _prt.add(["pt", ""]);
  _prt.add(["pt", "6.所有训练课程必须于此合约指定之会所进行。"]);
  _prt.add(["pt", "Personal Training Sessions must be executed only at Club of purchase."]);
  _prt.add(["pt", ""]);
  _prt.add(["pt", "7.若会员于课程完结前会籍到期或被撤销的，会员必须再次购买会籍方可开始课程且有效期不变，或遭本会撤销其会籍，有关之学费将不退回。"]);
  _prt.add(["pt", "In the event that membership expires or is terminated by club, the remaining un-conducted sessions are not refundable."]);
  _prt.add(["pt", ""]);
  _prt.add(["pt", "8.如欲撤换健身教练，需经公司允许，会员须于72小时前向本会所申请。 "]);
  _prt.add(["pt", "PT member must provide a minimum of 72 hours in advance subject to the company’s permission when requesting a change of Personal Trainer."]);
  _prt.add(["pt", ""]);
  _prt.add(["pt", "9.风险提示：如果购买了私教课程的公司卡发生公司卡其他使用者误用或冒用了该课程，由行为人承担责任。"]);
  _prt.add(["pt", "If one corporate-card member purchases PT sessions, and then another member with the same card misusing the sessions, the Welcome Company does not assume any responsibility."]);
  _prt.add(["pt", ""]);
  _prt.add(["pt", "10.威康公司提供会所内私人教练指导服务，公司禁止会员之间的营利或非营利的指导、陪练或示范等，如有发现本公司有权单方面解除本协议且不承担违约责任。"]);
  _prt.add(["pt", "The Will’s Company provides all personal training in the club. Any profitable or unprofitable instruction or sparring or demonstration etc. is not allowed within the club. The company has the right to terminate this agreement unilaterally and is not subject to any contract-breach responsibilities."]);
  _prt.add(["pt", ""]);
  _prt.add(["pt", "11.本文件具约束力，并取代任何口头或书面协定。若法院宣布本协定任何部分无效，本协定其余部分将不受影响继续有效。若威尔士集团因任何原因而未能行使本协定下的任何权利，并不代表会所将放弃于日后行使有关之权利。 "]);
  _prt.add(["pt", "This document is building and replaces an oral or written Agreement. If a court declares any part of this Agreement invalid it will not invalidate the remaining parts, which continue unaffected. If Will’s Group does not enforce any right of the Agreement for any reason, the Club does not waive the right to enforce it late."]);
  _prt.add(["pt", ""]);
  _prt.add(["pt", "12.“W Yoga馆仅限该馆的会员卡持有人使用”。"]);
  _prt.add(["pt", ""]);
  _prt.add(["pt", "本人已经阅读并同意遵守此申请表之会所守则及规条。"]);
  _prt.add(["pt", "I have read, understood and accepted the rules and regulations of the club at the back of this application form."]);

  _prt.add(["nl", 1]);
  _prt.add(["nt", "Member Signatre 会员签名：", 0.5]);
  if(contract.memberSign) {
    _prt.add(["my", -4]);
    _prt.add(["pi", contract.memberSign, 25, 8]);
  } else {
    _prt.add(["nl", 1]);
  }
  _prt.add(["pt", "Date 日期："+contract.saleDate]);

  _prt.add(["nl", 2]);
  _prt.add(["sf", "12pt 黑体"]);
  _prt.add(["nt", contract.companyName, 0.5]);
  _prt.add(["my", -13]);
  _prt.add(["mx", -20]);
  if(contract.sealPic) _prt.add(["pi", contract.sealPic, 39, 39]);
  _prt.add(["sf", "9pt 宋体"]);

  _prt.add(["nl", 5]);
  _prt.add(["pt", "合同打印日期: "+contract.printDate]);
  _prt.add(["pt", "合同打印人: "+contract.printUserName]);
  _prt.add(["pt", "合同打印门店: "+contract.printShopName]);
}

function printOk() {
  if(_contract) {
    getJson("_print?saleId="+_contract.saleId+"&contractType=02", function(data){
      if(data.ret) cload();
    });
  }
}